'''
2255. 统计是给定字符串前缀的字符串数目
'''
def countPrefixes(self, words, s):
    """
    :type words: List[str]
    :type s: str
    :rtype: int
    """
    ret = 0
    for i in range(0, len(words)):
        for j in range(0, len(s)+1):
            if words[i] == s[0:j]:
                ret += 1
                break

    return ret

print(countPrefixes("",["a", "b", "c", "ab", "bc", "abc"], "abc"))


'''
startswith 判断是否是前缀
'''

class Solution(object):
    def countPrefixes(self, words, s):
        """
        :type words: List[str]
        :type s: str
        :rtype: int
        """
        ret = 0
        for i in range(0, len(words)):
            if s.startswith(words[i]):
                ret += 1
        return ret
